<%@ include file="/common/taglibs.jsp"%>
<head>
	<title><fmt:message key="shopcarlist.title"/></title>
	<script type="text/javascript" src="<c:url value='/ext/scripts/product/product.js'/>"></script>
</head>
<script type="text/javascript"
	src="<c:url value='/ext/scripts/display/displaypage.js'/>">
</script>
<script>
jQuery(function(){
		jQuery("#displayallpage").val(${displayallpage});
		jQuery("#tz").val(${thispage});
	});
</script>

<div class="box_big">
<form id="deleteform" method="post">
<input type="hidden" name="ptmeth" value="${ptmeth}"/>
<input type="hidden" name="tz" value="${thispage}"/>
</form>
<form:form method="post" action="${ctx}/shopcar/shopcar.html?method=query" id="shopform">
<input type="hidden" id="orderid" name="orderid" value=""/>
<table>

   		
		<%-- <input type="button" value="<fmt:message key="shopcar.research"/>" class="btn_bluem" onclick="javascript:location.href='${ctx}/contiuneSearch.html'"/>
		<input type="button" value="<fmt:message key="shopcar.contiuneorder"/>" class="btn_bluem" onclick="javascript:location.href='${ctx}/contiuneorder.html'"/>--%>
		 <%-- <a href="#" onclick="shopcover();"><input type="button" value="<fmt:message key="shopcar.showcoverage"/>" class="btn_bluem"/></a>--%>
		
		 <td align="left" >
		 <table width="1400">
		 <input  type="button" value="<fmt:message key="shopcar.clearshopcar"/>" class="btn_blues" onclick="onClear();"/>
		<input type="button" value="<fmt:message key="shopcar.commitcompute"/>" class="btn_blues" onclick="return shopcarcommit();"/>
		</table>
		</td>
		
</table>
<input type="checkbox" onclick="selectAll('ordername')">&nbsp;&nbsp;<fmt:message key="shopcar.selectall"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="checkbox" onclick="">&nbsp;&nbsp;<fmt:message key="shopcar.Package"/>&nbsp;&nbsp;
<input type="checkbox" onclick="">&nbsp;&nbsp;<fmt:message key="shopcar.Compress"/>&nbsp;&nbsp;
<input type="checkbox" onclick="">&nbsp;&nbsp;<fmt:message key="shopcar.Encryption"/>&nbsp;&nbsp;
<input type="checkbox" onclick="">&nbsp;&nbsp;<fmt:message key="shopcar.Transfer"/>&nbsp;&nbsp;
<input type="checkbox" onclick="">&nbsp;&nbsp;<fmt:message key="shopcar.Burnner"/>&nbsp;&nbsp;

<display:table name="shopcarlist" cellspacing="0" cellpadding="0" requestURI=""  id="shopcars" size="${resultSize}" pagesize="${pagesize}" export="true" style="width:100%;" class="table_display" partialList="true">
	<display:column titleKey="common.select">
		<%--<shiro:hasPermission name="orderAuthoriy">--
			<shiro:lacksPermission name="${shopcars.satelliteid}_${shopcars.sensorid}_${shopcars.productlevel}">--%>
				<input type="checkbox" id="orderselect" name="ordername" value="${shopcars.orderid}" style="border-left:1px solid #feb808;" onclick="selectColumn()"/>
		<%--	</shiro:lacksPermission>
			<shiro:hasPermission name="${shopcars.satelliteid}_${shopcars.sensorid}_${shopcars.productlevel}">
				<input type="checkbox" id="orderselect" name="ordername" value="${shopcars.orderid}" style="border-left:1px solid #feb808;" onclick="selectColumn()" disabled="disabled"/>
		<%--	</shiro:hasPermission>
		</shiro:hasPermission>
		<shiro:lacksPermission name="orderAuthoriy">
			<input type="checkbox" id="orderselect" name="ordername" value="${shopcars.orderid}" style="border-left:1px solid #feb808;" onclick="selectColumn()" disabled="disabled"/>
		<%--</shiro:lacksPermission>--%>
	</display:column>
	<%--<display:column titleKey="product.sceneid" sortable="true">
	<a href="${ctx}/scene/sceneview.html?method=view&sceneid=${shopcars.sceneid}&productid=${shopcars.productid}&productlevel=${shopcars.productlevel}&satelliteid=${shopcars.satelliteid}&sensorid=${shopcars.sensorid}&tasktype=${shopcars.tasktype}" target="_blank">${shopcars.sceneid}</a>
	</display:column>--%>
	<%--
	<display:column titleKey="shopcar.ordertype" sortable="true">
		<c:forEach var="ot" items="${ordertypelist}">
			<c:if test="${shopcars.tasktype!= null && shopcars.tasktype eq ot.key}">
				${ot.value}
			</c:if>
		</c:forEach>
	</display:column>
	 --%>
	
	<%--<display:column titleKey="product.productlevel" sortable="true">
		<c:forEach var="pl" items="${productlevellist}">
			<c:if test="${shopcars.productlevel!= null && shopcars.productlevel eq pl.key}">
				${pl.value}
			</c:if>
		</c:forEach>
	</display:column>
	 --%>
	<display:column property="productid" titleKey="product.productid" sortable="true" />
	<display:column property="producttype" titleKey="productsearch.TypeProduct" sortable="true" />
	<display:column property="producttype" titleKey="productsearch.ProductColour" sortable="true" />
	<display:column property="satelliteid" titleKey="productsearch.Scale" sortable="true" maxLength="12"/>
	<display:column property="satelliteid" titleKey="productsearch.gsd" sortable="true" maxLength="12"/>
	<display:column property="satelliteid" titleKey="productsearch.scenedate" sortable="true" maxLength="12"/>
	<display:column property="satelliteid" titleKey="productsearch.centerlongitude" sortable="true" maxLength="12"/>
	<display:column property="satelliteid" titleKey="productsearch.centerlatitude" sortable="true" maxLength="12"/>
	<display:column property="satelliteid" titleKey="productsearch.topleftlatitude" sortable="true" maxLength="12"/>
	<display:column property="satelliteid" titleKey="productsearch.topleftlongitude" sortable="true" maxLength="12"/>
	<display:column property="satelliteid" titleKey="productsearch.bottomrightlatitude" sortable="true" maxLength="12"/>
	<display:column property="satelliteid" titleKey="productsearch.bottomrightlongitude" sortable="true" maxLength="12"/>
	
	<%--<display:column property="satelliteid" titleKey="product.satelliteid" sortable="true" maxLength="12"/>
	<display:column property="sensorid" titleKey="product.sensorid" sortable="true" maxLength="12"/>
	<display:column titleKey="product.producttype" sortable="true">
		<c:forEach var="pl" items="${producttypelist}">
			<c:if test="${shopcars.producttype!= null && shopcars.producttype eq pl.key}">
				${pl.value}
			</c:if>
		</c:forEach>
	</display:column>
	<%-- 
	<display:column property="price" titleKey="product.price" sortable="true" />
	--%> 
	
	<%--<display:column property="username" titleKey="product.orderusername" sortable="true" maxLength="10"/>
	<%--
	<display:column property="createtime" titleKey="product.ordertime" sortable="true" format="{0,date,yyyy-MM-dd HH:mm:ss}" maxLength="10"/>
	 --%>
	
	<%--<display:column titleKey="user.operate" style="border-right:1px solid #feb808;" media="html">
	</display:column>--%>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="${ctx}/shopcar/shopcar.html?method=view&orderid=${shopcars.orderid}"><fmt:message key="common.view"/></a>&nbsp;
	<c:if test="${shopcars.username eq localuser.username}">
	<a href="${ctx}/shopcar/shopcar.html?method=form&id=${shopcars.orderid}&tz=${thispage}&tasktype=${shopcars.tasktype}"><fmt:message key="common.update"/></a>
	&nbsp;
	<a onclick="onDelete(<c:out value="${shopcars.orderid}"/>);"><fmt:message key="common.delete"/></a>
	</c:if>
	<c:if test="${shopcars.username ne localuser.username}">
		<fmt:message key="common.update"/>
		&nbsp;
		<fmt:message key="common.delete"/>
	</c:if>
	
	<display:setProperty name="export.pdf" value="false" /> 
	<display:setProperty name="export.csv" value="false" /> 
	<display:setProperty name="export.xml" value="false" /> 
</display:table>
</form:form>
</div>
<script type="text/javascript">
      highlightTableRows("shopcars");
     function selectAll(select){ 
	  o=document.getElementsByName(select);
	  var orderid = "";
	  for(i=0;i<o.length;i++)
	  {
		  if(o[i].disabled!=true)
		  {
			o[i].checked=event.srcElement.checked;
			if(orderid=="")
			{
				orderid = o[i].value;
			}
			else
			{
				orderid += "," + o[i].value;
			}
		  }
	   }
	   document.getElementById("orderid").value=orderid;
    }
    function selectColumn()
    {
    	var checkboxlist = document.getElementsByName("ordername");
    	document.getElementById("orderid").value="";
    	var orderid = "";
    	for(var i=0;i<checkboxlist.length;i++)
   		{
   			if(checkboxlist[i].checked)
 			{
 				if(orderid=="")
 				{
 					orderid = checkboxlist[i].value;
 				}
 				else
 				{
 					orderid += "," + checkboxlist[i].value;
 				}
 			}
   		}
    	document.getElementById("orderid").value=orderid;
    }
    
    function onDelete(id)
    {
    	var msg = "<fmt:message key="shopcar.deletemsg"/>";
    	ans = confirm(msg);
    	if(ans)
   		{
	    	var form = document.getElementById("deleteform");
	    	form.action = "${ctx}/shopcar/shopcar.html?method=delete&operate=delete&id="+id;
	    	form.submit();
   		}
    }
    
    function onClear()
    {
    	var msg="<fmt:message key="shopcar.clearmsg"/>";
    	ans = confirm(msg);
    	if(ans)
    	{
    		var form = document.getElementById("deleteform");
    		form.action="${ctx}/shopcar/shopcar.html?method=clear";
    		form.submit();
    	}
    }
    
    function shopcarcommit(obj)
	{
		var chk = document.getElementsByName("ordername");
		var j = 0;
		for(var i=0;i<chk.length;i++)
		{
			if(chk[i].checked)
				j++;
		}
		if(j==0)
		{
			alert("<fmt:message key="shopcarlist.commitmsg"/>");
			return false;
		}
		var form = document.getElementById("shopform");
		form.action = "shopcar.html?method=commit";
		form.submit();
	}
    function shopcover()
	{
    	var orderid = document.getElementById("orderid").value;
		window.open("${ctx}/shopcar/shopcar.html?method=cover&viewmethod=shopcar&orderid="+orderid,"_blank");
	}
</script>
